#import "WBWindow.h"
#import <AppKit/AppKit.h>

@implementation WBWindow

- (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag {

    NSWindow* result = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO];
    [result setBackgroundColor: [NSColor clearColor]];
    [result setLevel: NSStatusWindowLevel];
    [result setAlphaValue:1.0];
    [result setOpaque:NO];
    [result setHasShadow: YES];
	
	// Get the main screen information.
    NSScreen* mainScreen = [NSScreen mainScreen];
	NSRect winRect = [mainScreen frame];	
	
	// position the window in the middle of the screen
	NSPoint origin;
	origin.x = winRect.size.width*(1 - 0.618);
	origin.y = winRect.size.height*(1 - 0.618);
	[result setFrameOrigin:origin];

    return result;
}

- (BOOL) canBecomeKeyWindow
{
    return YES;
}

// disallow drag
- (void)mouseDragged:(NSEvent *)theEvent
{
	return;
}

@end
